<template>
	<view class="detailWrapper">
		<view class="noRun">
			<view class="detailHeader">
				<button class="back" @tap="backLast()"></button>
				货品详情
				<button class="change" style="display: none;"></button>
			</view>
		</view>
		<view class="detailContainer">
			<view class="GoodsNameWrap">
				<image src="http://pic.rmb.bdstatic.com/819a044daa66718c2c40a48c1ba971e6.jpeg" class="goodsImg"></image>
				<view class="goodsInfo">
					<view class="goodsName">
						<text>货品名称</text>
						<text>智能手机</text>
					</view>
					<view class="goodsBar">
						<text>条形码</text>
						<text>20161012007</text>
					</view>
				</view>
			</view>
		    <view class="goodType">
		    	<text>货品类型</text>
		    	<text>智能手机</text>
		    </view>
		    <view class="goodJcInfo">
				<view>
					<text>单位</text>
					<text>部</text>
				</view>
				<view>
					<text>进货价</text>
					<text>13</text>
				</view>
				<view>
					<text>批发价</text>
					<text>14</text>
				</view>
				<view>
					<text>零售价</text>
					<text>15</text>
				</view>
				<view>
					<text>初期成本</text>
					<text>16</text>
				</view>
			</view>
			<view class="goodKcInfo">
				<view class="kcSet">
					<text>当前库存</text>
					<view class="settingKc"><text>{{nowNum}}</text><button @tap="changeKc">调整</button></view>
				</view>
				<view>
					<text>初期库存</text>
					<text>13</text>
				</view>
				<view>
					<text>安全库存</text>
					<text>14</text>
				</view>
			</view>
		    <view class="goodAsForm">
				<text>供应商</text>
				<text>{{goodInfo.Remark}}</text>
			</view>
			<view class="goodReturm">
				<text>备注</text>
				<text>{{goodInfo.Remark}}</text>
			</view>
		</view>
		<view class="Modal_Wrap" v-show="isShowDialog">
			<view class="Model">
				<view class="modelTitle">
					商品名称
				</view>
				<view class="modelContains">
				    <view>
						<text>当前库存</text>
						<input type="number" disabled :value="nowNum"/>
						<text>台</text>
					</view>
					<view>
						<text>修改库存</text>
						<input type="number" @input="changeNum"/>
						<text>台</text>
					</view>
					<view>
						<text>备注</text>
						<text>台</text>
					</view>
				</view>
			    <view class="modalOptions">
					<view @tap="cancel(0)">取消</view>
					<view @tap="cancel(1)">确认</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import tabBar from "../../components/tabBar.vue"
	export default {
		data() {
			return {
				kcNum:0,
				nowNum:0,
				isShowDialog:false,
				goodInfo:{}
			};
		},
		components:{
		    
		},
		onLoad(options) {
			this.goodInfo = options.goodData;
		},
		methods:{
			backLast:function(){
				uni.navigateBack({
					delta:1
				})
			},
			changeNum:function(event){
				 var value = event.target.value;
				 this.kcNum = value;
			},
			cancel:function(state){
				if(state==0){
					this.isShowDialog = false;
				}else{
					this.nowNum = this.kcNum == ""?0:this.kcNum ;
					this.isShowDialog = false;
				}
				
			},
			changeKc:function(){
				this.isShowDialog = true;
			}
		}
	}
</script>

<style>
	@import url("./detail.css");
</style>
